package thread;
/**
 * 获取线程相关信息的一组方法
 * @author Xiloer
 *
 */
public class ThreadInfoDemo {
	public static void main(String[] args) {
		Thread t = Thread.currentThread();
		
		String name = t.getName();
		System.out.println("线程名字:"+name);
		
		long id = t.getId();
		System.out.println("唯一标识:"+id);
		
		int priority = t.getPriority();
		System.out.println("优先级:"+priority);
		
		//查看当前线程是否还活着
		boolean isAlive = t.isAlive();
		System.out.println("isAlive:"+isAlive);
		//查看线程是否为守护线程
		boolean isDaemon = t.isDaemon();
		System.out.println("isDaemon:"+isDaemon);
		//查看线程是否被中断了
		boolean isInterrupted = t.isInterrupted();
		System.out.println("isInterrupted:"+isInterrupted);
		
		
	}
}








